package com.sz.admin.ai.factory.chatFactory.entity;

import lombok.AllArgsConstructor;
import lombok.Getter;

import java.util.Objects;

/**
 * @描述:
 * @Author: TangYuan
 * @Date: 2025/3/5 15:27
 */
@Getter
@AllArgsConstructor
public enum MessageTypoeEnum {
    
    SYSTEM("SYSTEM", "system"),
    ASSISTANT("ASSISTANT", "assistant"),
    USER("USER", "user"),
    UNKNOWN("UNKNOWN", "unknown"),
    ;
    
    private final String capitalString;
    
    private final String lowercaseString;
    
    
    public static MessageTypoeEnum getEnum(String string) {
        for (MessageTypoeEnum value : MessageTypoeEnum.values()) {
            if (Objects.equals(value.getCapitalString(), string) || Objects.equals(value.getLowercaseString(), string)) {
                return value;
            }
        }
        return MessageTypoeEnum.UNKNOWN;
    }
    
    public static MessageTypoeEnum getEnumByCapital(String capitalString) {
        for (MessageTypoeEnum value : MessageTypoeEnum.values()) {
            if (Objects.equals(value.getCapitalString(), capitalString)) {
                return value;
            }
        }
        return MessageTypoeEnum.UNKNOWN;
    }
    
    public static MessageTypoeEnum getEnumByLowercase(String lowercaseString) {
        for (MessageTypoeEnum value : MessageTypoeEnum.values()) {
            if (Objects.equals(value.getLowercaseString(), lowercaseString)) {
                return value;
            }
        }
        return MessageTypoeEnum.UNKNOWN;
    }
}
